package LuoGu.搜索.临阵抱佛脚;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        int temp [] = new int [4];
        int ans = 0;
        for(int i=0;i<4;i++){
            st.nextToken();
            temp[i] = (int) st.nval;
        }
        for(int i=0;i<4;i++){
            int [] tt = new int [temp[i]];
            int sum = 0;
            for(int j=0;j<temp[i];j++){
                st.nextToken();
                tt[j] = (int) st.nval;
                sum+=tt[j];
            }
            int [] dp = new int [sum];
            for(int j=0;j<temp[i];j++){
                for(int k = sum/2;k>=tt[j];k--){
                    dp[k] = Math.max(dp[k],dp[k-tt[j]]+tt[j]);
                }
            }
            ans+=sum-dp[sum/2];
        }
        System.out.print(ans);
    }
}
